package com.aruba.controller;

import com.aruba.bean.Emp;
import com.aruba.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class EmpController {
    @Autowired
    private EmpService empService;

    @RequestMapping("findAllEmp")
    @ResponseBody
    public List<Emp> findAllEmp() {
        return empService.findAllEmp();
    }

    @RequestMapping("findEmpByPage/{pageSize}/{pageNum}")
    @ResponseBody
    public List<Emp> findEmpByPage(@PathVariable("pageSize") Integer pageSize,
                                   @PathVariable("pageNum") Integer pageNum) {
        return empService.findEmpByPage(pageSize, pageNum);
    }

}
